package com.green.card.utils;

import android.content.Context;

import org.apache.http.util.EncodingUtils;

import java.io.InputStream;

/**
 * Created by admin on 2018/1/27.
 */

public class PackegeIdUtils {
    /**
     * 获取raw目录下的包号
     * @param context
     * @param Id
     * @return
     */
    public static String getRawFileContent(Context context, int Id) {
        String ret = "";
        try {
            InputStream is = context.getApplicationContext().getResources().openRawResource(Id);
            int len = is.available();
            byte[] buffer = new byte[len];
            is.read(buffer);
            ret = EncodingUtils.getString(buffer, "utf-8");
            is.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ret;
    }
}
